<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page errorPage="../error/404.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<title>个人信息</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
<meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" href="/layui/css/layui.css" media="all" />
<link rel="stylesheet" href="/css/font_eolqem241z66flxr.css"
	media="all" />
<link rel="stylesheet" href="/css/list.css" media="all" />
    <style type="text/css">
    .laytable-cell-1-img{  /*最后的pic为字段的field*/
      width:30px;
      height:30px;
   }
    
    
    </style>
</head>
<body class="childrenBody">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend style="text-align: center">${admin.realname}博客</legend>
</fieldset>
	
	<div class="layui-form">
		<table id="personinfoList" lay-filter="personinfoList"></table>
	</div>
	<script type="text/javascript" src="/layui/layui.js"></script>
	<script type="text/html" id="barEdit">
  		<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>  		
	</script>
	
		
	<script>
		layui
				.config({
					base : "js/"
				})
				.use(
						[ 'form', 'layer', 'jquery', 'table', 'laydate' ],
						function() {
							var form = layui.form, table = layui.table, layer = parent.layer === undefined ? layui.layer
									: parent.layer, laydate = layui.laydate
									$ = layui.jquery,
									nowTime = new Date().valueOf(),
								
							//加载页面数据
							table
									.render({
										id : 'personinfoList',
										elem : '#personinfoList',
										url : '/personinfo/personinfoList' //数据接口
										,
										limit : 10//每页默认数
										,
										limits : [ 10, 20, 30, 40 ],
										cols : [ [ //表头
												{
													type : 'checkbox'
												},
												{
													field : 'id',
													title : '编号',
													width : 60
												},
												{
													field : 'name',
													title : '姓名'
												},
												{
													field : 'avatar',
													title : '头像',
													templet:'<div><img src="{{d.avatar}}" ></div>'
												},	
												{
													field : 'description',
													title : '简介'
													
												},
												{
													field : 'occupation',
													title : '事迹'
													
												},											
													{
													field : 'content',
													title : '内心独白'
													
												},	
														{
													field : 'createtime',
													title : '创建时间',
													templet : '<div>{{ formatTime(d.createtime,"yyyy-MM-dd hh:mm:ss")}}</div>'
													
												},		{
													field : 'indexpage',
													title : '主页'
													
												},			{
													field : 'indexdownloadurl',
													title : '下载地址'
													
												},	
													{
													field : 'indexpageurl',
													title : '模板采用链接'
													
												},		
													{
													field : 'myprogremlange',
													title : '网站程序'
													
												},	
													{
													field : 'myprogremurl',
													title : '下载地址'
													
												},	
													{
													field : 'servervender',
													title : '服务器商家'
													
												},	
													{
													field : 'servervenderurl',
													title : '服务器推广链接'
													
												},	
													{
													field : 'freecloudspace',
													title : '免费云空间'
													
												},	
													{
													field : 'freecloudspacedes',
													title : '云空间地址'
													
												},	
													{
													field : 'imagefirst',
													title : 'java学习交流群1',
													templet:'<div><img src="{{d.imagefirst}}" ></div>'
													
												},	
													{
													field : 'imagetwoth',
													title : 'java学习交流群2',
													templet:'<div><img src="{{d.imagetwoth}}" ></div>'
												},	
													{
													field : 'imagethirth',
													title : '微信公众号图片',
													templet:'<div><img src="{{d.imagethirth}}" ></div>'
												},	
													{
													field : 'imagefourth',
													title : '微信交流群图片',
													templet:'<div><img src="{{d.imagefourth}}" ></div>'
												},	
													{
													field : 'imagefirstqq',
													title : 'qq群号1'
													
												},	
													{
													field : 'imagetwothqq',
													title : 'qq群号2'
													
												},	
													{
													field : 'imagethirthwechat',
													title : '微信群号'
													
												},								
											
												{
													title : '操作',
													toolbar : '#barEdit'
												} ] ],
										page : true										
									//开启分页
									});
		
							//监听工具条
							table.on('tool(personinfoList)', function(obj) {
								var data = obj.data;
							if (obj.event === 'edit') {
									layer.open({
										type : 2,
										title : "修改个人信息",
										area : [ '800px', '600px' ],
										content : "/personinfo/page/editpersoninfo/"+ data.id //这里content是一个普通的String
									})
								}

							});

						

						

						

						})

		//格式化时间
		function formatTime(datetime, fmt) {
			if (datetime == null || datetime == 0) {
				return "";
			}
			if (parseInt(datetime) == datetime) {
				if (datetime.length == 10) {
					datetime = parseInt(datetime) * 1000;
				} else if (datetime.length == 13) {
					datetime = parseInt(datetime);
				}
			}
			datetime = new Date(datetime);
			var o = {
				"M+" : datetime.getMonth() + 1, //月份   
				"d+" : datetime.getDate(), //日   
				"h+" : datetime.getHours(), //小时   
				"m+" : datetime.getMinutes(), //分   
				"s+" : datetime.getSeconds(), //秒   
				"q+" : Math.floor((datetime.getMonth() + 3) / 3), //季度   
				"S" : datetime.getMilliseconds()
			//毫秒   
			};
			if (/(y+)/.test(fmt))
				fmt = fmt.replace(RegExp.$1, (datetime.getFullYear() + "")
						.substr(4 - RegExp.$1.length));
			for ( var k in o)
				if (new RegExp("(" + k + ")").test(fmt))
					fmt = fmt.replace(RegExp.$1,
							(RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k])
									.substr(("" + o[k]).length)));
			return fmt;
		}
	</script>
</body>

</html>